package com.lanou.fooddemo.listener;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.view.View;

import com.lanou.fooddemo.R;
import com.lanou.fooddemo.activity.BasketActivity;
import com.lanou.fooddemo.activity.NoticeInformationActivity;
import com.lanou.fooddemo.activity.ThemeListActivity;

/**
 * Created by dllo on 2015/8/18.
 */
public class MainTabMenuItemOnClickListener implements View.OnClickListener {
    private Activity activity;
    /**
     * 记录控件视图
     */
    private Context context;
    public MainTabMenuItemOnClickListener(Activity activity) {
        this.activity = activity;
    }
    public void setActivity(Activity activity) {
        this.activity = activity;
    }
    @Override
    public void onClick(View v) {
        context = v.getContext();
        switch (v.getId()) {
            case R.id.slidingMenuItemOne :
                Intent intentOne = new Intent(context, BasketActivity.class);
                context.startActivity(intentOne);
                break;
            case R.id.slidingMenuItemTwo :
                Intent intentTwo = new Intent(context, ThemeListActivity.class);
                context.startActivity(intentTwo);
                break;
            case R.id.slidingMenuItemThree :
                Intent intentThree = new Intent(context, NoticeInformationActivity.class);
                context.startActivity(intentThree);
                break;
            case R.id.slidingMenuItemFour :
                activity.finish();
                break;
        }
    }
}
